package lg.minecraft.plugin.testeconomy.config;

import lg.minecraft.plugin.testeconomy.TestEconomy;
import lg.minecraft.plugin.testeconomy.storage.StorageType;
import lombok.Getter;

import java.util.List;

/**
 * @author langle__
 * @version 1.0
 */
@Getter
public class ManiConfig extends BaseConfig {

    private StorageType storageType;

    private String ymlPath;
    private String jsonPath;
    private String xmlPath;
    private String sqlitePath;

    private String mySqlHost;
    private int mySqlPort;
    private String mySqlUser;
    private String mySqlPassword;
    private String mySqlDataBase;
    private List<String> mySqlArgList;

    public ManiConfig() {
        super(TestEconomy.getInstance(), "config.yml");
        saveDefault();
        load();
    }

    @Override
    public void load() {
        super.load();

        String storageTypeString = getString("storage", "YAML");
        storageType = StorageType.getStorageType(storageTypeString);

        ymlPath = getString("yml.path");
        jsonPath = getString("json.path");
        xmlPath = getString("xml.path");
        sqlitePath = getString("sqlite.path");

        this.mySqlHost = getString("mysql.host");
        this.mySqlPort = getInt("mysql.port");
        this.mySqlUser = getString("mysql.user");
        this.mySqlPassword = getString("mysql.password");
        this.mySqlDataBase = getString("mysql.database");
        this.mySqlArgList = getStringList("mysql.args");

    }

}
